<!DOCTYPE html>
<html>
<head>
  <title>组织机构信息表添加</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="../bootstrap4/css/bootstrap.min.css">
  <link rel="stylesheet" href="../css2/style2.css"> 
  <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/lib/jquery.js"></script>
  <script src="http://static.runoob.com/assets/jquery-validation-1.14.0/dist/jquery.validate.min.js"></script>
  <script src="../js2/my.js"></script>
</head>

<script type="text/javascript">
$(function(){
	$("#formID").validate({
        rules: {
            "orgLname": {
                required: true
            }, 
            "orgUser": {
                required: true
            },
            "orgTel": {
                required: true
            } 
        },
        messages:{
            "orgLname": {
                required: "机构简称不能为空"
            },
            "orgUser": {
                required: "机构联系人不能为空"
            },
            "orgTel": {
                required: "机构联系电话不能为空"
            } 
        },
        submitHandler:function(form){
        	$.ajax({
        		type: "POST",//方法类型
                dataType: "json",//预期服务器返回的数据类型
                url: "saveOrgInfo" ,//url
                data: $('#formID').serialize(),
                success: function (result) {
                    console.log(result);//打印服务端返回的数据(调试用)
                    if (result.code == 200) {
                        if(confirm(result.msg+'是否继续？？'))
                        {   
                        	 window.location.href = "addOrgInfo";
                        }
                        else
                        {  
                        	 window.location.href = "queryForOrgInfoList";
                        }
                    }
                    else{                	
                    	alert(result.msg);
                    }
                     
                },
                error : function() {
                    alert("异常！");
                }
            });
        },
        //自定义错误样式
        errorClass:"text-danger",
        //未通过验证,进行高亮处理或其他处理；
        highlight:function(input){
            $(input).closest(".form-group").addClass("has-error");
        },
        //通过验证,清除高亮效果或其他处理；
        unhighlight:function(input){
            $(input).closest(".form-group").removeClass("has-error");
        }
	});
});

</script>
<body>
<div class="header-area" id="headerArea">
   <div class="container h-100 d-flex align-items-center justify-content-between">
 
     <div class="logo-wrapper">
     <a th:href="@{queryForOrgInfoList}"> 返回 </a>
	 </div>
     <!-- Search Form-->
     <div class="top-search-form">
      	 组织机构信息表添加
     </div>
     <div  id="suhaNavbarToggler"><span></span><span></span><span></span></div>
   </div>
 </div>

<div class="container mt60">
  <form id="formID"  >
  	<input type="hidden" name="orgId" th:value="${orgInfoVO?.orgId}" /> 
    <div class="form-group">
       <div class="single-payment-method"> 
       		<img class="mb-3" src="../img/bg-img/11.jpeg"   width="100%"alt="">
       </div>
    </div>
    <div class="form-group"> 
      <label class="title fl"></label>
      <label for="orgLname" class="fl" >机构简称:</label>
      <input type="text" class="form-control" id="orgLname" placeholder="请填写机构简称" 
      name="orgLname"
      th:value="${orgInfoVO?.orgLname}" >
    </div>
    <div class="form-group"> 
      <label class="title fl"></label>
      <label for="orgHname" class="fl" >机构全名:</label>
      <input type="text" class="form-control" id="orgHname" placeholder="请填写机构全名" 
      name="orgHname"
      th:value="${orgInfoVO?.orgHname}" >
    </div>
    <div class="form-group"> 
      <label class="title fl"></label>
      <label for="orgCode" class="fl" >机构编号:</label>
      <input type="text" class="form-control" id="orgCode" placeholder="请填写机构编号" 
      name="orgCode"
      th:value="${orgInfoVO?.orgCode}" >
    </div>
    <div class="form-group"> 
      <label class="title fl"></label>
      <label for="orgUser" class="fl" >机构联系人:</label>
      <input type="text" class="form-control" id="orgUser" placeholder="请填写机构联系人" 
      name="orgUser"
      th:value="${orgInfoVO?.orgUser}" >
    </div>
    <div class="form-group"> 
      <label class="title fl"></label>
      <label for="orgTel" class="fl" >机构联系电话:</label>
      <input type="text" class="form-control" id="orgTel" placeholder="请填写机构联系电话" 
      name="orgTel"
      th:value="${orgInfoVO?.orgTel}" >
    </div>
    <div class="form-group"> 
      <label class="title fl"></label>
      <label for="orgEmail" class="fl" >机构邮箱:</label>
      <input type="text" class="form-control" id="orgEmail" placeholder="请填写机构邮箱" 
      name="orgEmail"
      th:value="${orgInfoVO?.orgEmail}" >
    </div>
    <div class="form-group"> 
      <label class="title fl"></label>
      <label for="orgAdda" class="fl" >机构地址（省）:</label>
      <input type="text" class="form-control" id="orgAdda" placeholder="请填写机构地址（省）" 
      name="orgAdda"
      th:value="${orgInfoVO?.orgAdda}" >
    </div>
    <div class="form-group"> 
      <label class="title fl"></label>
      <label for="orgAddb" class="fl" >机构地址（市）:</label>
      <input type="text" class="form-control" id="orgAddb" placeholder="请填写机构地址（市）" 
      name="orgAddb"
      th:value="${orgInfoVO?.orgAddb}" >
    </div>
    <div class="form-group"> 
      <label class="title fl"></label>
      <label for="orgAddc" class="fl" >机构地址（地区）:</label>
      <input type="text" class="form-control" id="orgAddc" placeholder="请填写机构地址（地区）" 
      name="orgAddc"
      th:value="${orgInfoVO?.orgAddc}" >
    </div>
    <div class="form-group"> 
      <label class="title fl"></label>
      <label for="orgAddd" class="fl" >机构地址（乡镇）:</label>
      <input type="text" class="form-control" id="orgAddd" placeholder="请填写机构地址（乡镇）" 
      name="orgAddd"
      th:value="${orgInfoVO?.orgAddd}" >
    </div>
    <div class="form-group"> 
      <label class="title fl"></label>
      <label for="orgAdde" class="fl" >机构地址（村）:</label>
      <input type="text" class="form-control" id="orgAdde" placeholder="请填写机构地址（村）" 
      name="orgAdde"
      th:value="${orgInfoVO?.orgAdde}" >
    </div>
    <div class="form-group"> 
      <label class="title fl"></label>
      <label for="orgLon" class="fl" >经度:</label>
      <input type="text" class="form-control" id="orgLon" placeholder="请填写经度" 
      name="orgLon"
      th:value="${orgInfoVO?.orgLon}" >
    </div>
    <div class="form-group"> 
      <label class="title fl"></label>
      <label for="orgLat" class="fl" >纬度:</label>
      <input type="text" class="form-control" id="orgLat" placeholder="请填写纬度" 
      name="orgLat"
      th:value="${orgInfoVO?.orgLat}" >
    </div>
    <div class="form-group"> 
      <label class="title fl"></label>
      <label for="orgPcode" class="fl" >机构邮编:</label>
      <input type="text" class="form-control" id="orgPcode" placeholder="请填写机构邮编" 
      name="orgPcode"
      th:value="${orgInfoVO?.orgPcode}" >
    </div>
    <div class="form-group"> 
      <label class="title fl"></label>
      <label for="orgSort" class="fl" >机构排序:</label>
      <input type="text" class="form-control" id="orgSort" placeholder="请填写机构排序" 
      name="orgSort"
      th:value="${orgInfoVO?.orgSort}" >
    </div>
     <button type="submit" class="btn btn-primary btn-block" >提交</button>
  </form>
 
</div>

</body>
</html>
